package main

import "fmt"

func canConstruct(ransomNote string, magazine string) bool {
	if len(magazine) < len(ransomNote) {
		return false
	}
	rArray := make([]int, 26)
	mArray := make([]int, 26)
	ra := []rune(ransomNote)
	for _, r := range ra {
		rArray[int(r-'a')]++
	}
	ma := []rune(magazine)
	for _, r := range ma {
		mArray[int(r-'a')]++
	}
	for i, v := range rArray {
		if v > mArray[i] {
			return false
		}
	}
	return true
}

func main() {
	fmt.Println(canConstruct("a", "b"))
	fmt.Println(canConstruct("aa", "ab"))
	fmt.Println(canConstruct("aa", "aab"))
}
